<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        
    </style>
</head>
<body>
    
</body>
<script>
        var obj = {
        name:"lisa",
        age:18,
        sex:"女",
        hobby:["唱歌","画画","足球"],
        sayHello:function(){
            console.log("hello ，我叫" + obj.name);
        },
   
    }

    var str = "hobby";
    console.log(obj[str]);      // 等同于：obj.hobby

    
    console.log(obj["sex"]);

    obj.sayHello();

    
    
    console.log(obj);
</script>
</html>